home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_136 / bison / bison.simple < prev    next >
Text File  |  1992-05-06  |  15KB  |  504 lines

  1. #line 2 "bison.simple"
  2.  
  3. /* Skeleton output parser for bison,
  4.    copyright (C) 1984 Bob Corbett and Richard Stallman
  5.  
  6.                NO WARRANTY
  7.  
  8.   BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  9. NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  10. WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  11. RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
  12. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  13. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  14. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  15. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  16. DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  17. CORRECTION.
  18.  
  19.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
  20. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
  21. WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
  22. LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
  23. OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  24. USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  25. DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
  26. A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
  27. PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  28. DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  29.  
  30.         GENERAL PUBLIC LICENSE TO COPY
  31.  
  32.   1. You may copy and distribute verbatim copies of this source file
  33. as you receive it, in any medium, provided that you conspicuously and
  34. appropriately publish on each copy a valid copyright notice "Copyright
  35. (C) 1985 Free Software Foundation, Inc."; and include following the
  36. copyright notice a verbatim copy of the above disclaimer of warranty
  37. and of this License.  You may charge a distribution fee for the
  38. physical act of transferring a copy.
  39.  
  40.   2. You may modify your copy or copies of this source file or
  41. any portion of it, and copy and distribute such modifications under
  42. the terms of Paragraph 1 above, provided that you also do the following:
  43.  
  44.     a) cause the modified files to carry prominent notices stating
  45.     that you changed the files and the date of any change; and
  46.  
  47.     b) cause the whole of any work that you distribute or publish,
  48.     that in whole or in part contains or is a derivative of this
  49.     program or any part thereof, to be licensed at no charge to all
  50.     third parties on terms identical to those contained in this
  51.     License Agreement (except that you may choose to grant more
  52.     extensive warranty protection to third parties, at your option).
  53.  
  54.     c) You may charge a distribution fee for the physical act of
  55.     transferring a copy, and you may at your option offer warranty
  56.     protection in exchange for a fee.
  57.  
  58.   3. You may copy and distribute this program or any portion of it in
  59. compiled, executable or object code form under the terms of Paragraphs
  60. 1 and 2 above provided that you do the following:
  61.  
  62.     a) cause each such copy to be accompanied by the
  63.     corresponding machine-readable source code, which must
  64.     be distributed under the terms of Paragraphs 1 and 2 above; or,
  65.  
  66.     b) cause each such copy to be accompanied by a
  67.     written offer, with no time limit, to give any third party
  68.     free (except for a nominal shipping charge) a machine readable
  69.     copy of the corresponding source code, to be distributed
  70.     under the terms of Paragraphs 1 and 2 above; or,
  71.  
  72.     c) in the case of a recipient of this program in compiled, executable
  73.     or object code form (without the corresponding source code) you
  74.     shall cause copies you distribute to be accompanied by a copy
  75.     of the written offer of source code which you received along
  76.     with the copy you received.
  77.  
  78.   4. You may not copy, sublicense, distribute or transfer this program
  79. except as expressly provided under this License Agreement.  Any attempt
  80. otherwise to copy, sublicense, distribute or transfer this program is void and
  81. your rights to use the program under this License agreement shall be
  82. automatically terminated.  However, parties who have received computer
  83. software programs from you with this License Agreement will not have
  84. their licenses terminated so long as such parties remain in full compliance.
  85.  
  86.   5. If you wish to incorporate parts of this program into other free
  87. programs whose distribution conditions are different, write to the Free
  88. Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
  89. worked out a simple rule that can be stated here, but we will often permit
  90. this.  We will be guided by the two goals of preserving the free status of
  91. all derivatives of our free software and of promoting the sharing and reuse of
  92. software.
  93.  
  94.  
  95. In other words, you are welcome to use, share and improve this program.
  96. You are forbidden to forbid anyone else to use, share and improve
  97. what you give them.   Help stamp out software-hoarding!  */
  98.  
  99. /* This is the parser code that is written into each bison parser
  100.   when the %semantic_parser declaration is not specified in the grammar.
  101.   It was written by Richard Stallman by simplifying the hairy parser
  102.   used when %semantic_parser is specified.  */
  103.  
  104. /* Note: there must be only one dollar sign in this file.
  105.    It is replaced by the list of actions, each action
  106.    as one case of the switch.  */
  107.  
  108. #define yyerrok        (yyerrstatus = 0)
  109. #define yyclearin    (yychar = YYEMPTY)
  110. #define YYEMPTY        -2
  111. #define YYEOF        0
  112. #define YYFAIL        goto yyerrlab;
  113.  
  114. #define YYTERROR    1
  115.  
  116. #ifndef YYIMPURE
  117. #define YYLEX        yylex()
  118. #endif
  119.  
  120. #ifndef YYPURE
  121. #define YYLEX        yylex(&yylval, &yylloc)
  122. #endif
  123.  
  124. /* If nonreentrant, generate the variables here */
  125.  
  126. #ifndef YYIMPURE
  127.  
  128. int    yychar;            /*  the lookahead symbol        */
  129. YYSTYPE    yylval;            /*  the semantic value of the        */
  130.                 /*  lookahead symbol            */
  131.  
  132. YYLTYPE yylloc;            /*  location data for the lookahead    */
  133.                 /*  symbol                */
  134.  
  135. int yydebug = 0;        /*  nonzero means print parse trace    */
  136.  
  137. #endif  /* YYIMPURE */
  138.  
  139.  
  140. /*  YYMAXDEPTH indicates the initial size of the parser's stacks    */
  141.  
  142. #ifndef    YYMAXDEPTH
  143. #define YYMAXDEPTH 200
  144. #endif
  145.  
  146. /*  YYMAXLIMIT is the maximum size the stacks can grow to
  147.     (effective only if the built-in stack extension method is used).  */
  148.  
  149. #ifndef YYMAXLIMIT
  150. #define YYMAXLIMIT 10000
  151. #endif
  152.  
  153.  
  154. #line 87 "bison.simple"
  155. int
  156. yyparse()
  157. {
  158.   register int yystate;
  159.   register int yyn;
  160.   register short *yyssp;
  161.   register YYSTYPE *yyvsp;
  162.   YYLTYPE *yylsp;
  163.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  164.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  165.  
  166.   short    yyssa[YYMAXDEPTH];    /*  the state stack            */
  167.   YYSTYPE yyvsa[YYMAXDEPTH];    /*  the semantic value stack        */
  168.   YYLTYPE yylsa[YYMAXDEPTH];    /*  the location stack            */
  169.  
  170.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  171.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  172.   YYLTYPE *yyls = yylsa;
  173.  
  174.   int yymaxdepth = YYMAXDEPTH;
  175.  
  176. #ifndef YYPURE
  177.  
  178.   int yychar;
  179.   YYSTYPE yylval;
  180.   YYLTYPE yylloc;
  181.  
  182.   extern int yydebug;
  183.  
  184. #endif
  185.  
  186.  
  187.   YYSTYPE yyval;        /*  the variable used to return        */
  188.                 /*  semantic values from the action    */
  189.                 /*  routines                */
  190.  
  191.   int yylen;
  192.  
  193.   if (yydebug)
  194.     fprintf(stderr, "Starting parse\n");
  195.  
  196.   yystate = 0;
  197.   yyerrstatus = 0;
  198.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  199.  
  200.   /* Initialize stack pointers.
  201.      Waste one element of value and location stack
  202.      so that they stay on the same level as the state stack.  */
  203.  
  204.   yyssp = yyss - 1;
  205.   yyvsp = yyvs;
  206.   yylsp = yyls;
  207.  
  208. /* Push a new state, which is found in  yystate  .  */
  209. /* In all cases, when you get here, the value and location stacks
  210.    have just been pushed. so pushing a state here evens the stacks.  */
  211. yynewstate:
  212.  
  213.   *++yyssp = yystate;
  214.  
  215.   if (yyssp >= yyss + yymaxdepth - 1)
  216.     {
  217.       /* Give user a chance to reallocate the stack */
  218.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  219.       YYSTYPE *yyvs1 = yyvs;
  220.       YYLTYPE *yyls1 = yyls;
  221.       short *yyss1 = yyss;
  222.  
  223.       /* Get the current used size of the three stacks, in elements.  */
  224.       int size = yyssp - yyss + 1;
  225.  
  226. #ifdef yyoverflow
  227.       /* Each stack pointer address is followed by the size of
  228.      the data in use in that stack, in bytes.  */
  229.       yyoverflow("parser stack overflow",
  230.          &yyss1, size * sizeof (*yyssp),
  231.          &yyvs1, size * sizeof (*yyvsp),
  232.          &yyls1, size * sizeof (*yylsp),
  233.          &yymaxdepth);
  234.  
  235.       yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
  236. #else /* no yyoverflow */
  237.       /* Extend the stack our own way.  */
  238.       if (yymaxdepth >= YYMAXLIMIT)
  239.     yyerror("parser stack overflow");
  240.       yymaxdepth *= 2;
  241.       if (yymaxdepth > YYMAXLIMIT)
  242.     yymaxdepth = YYMAXLIMIT;
  243.       yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
  244.       bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  245.       yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
  246.       bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  247.       yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
  248.       bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  249. #endif /* no yyoverflow */
  250.  
  251.       yyssp = yyss + size - 1;
  252.       yylsp = yyls + size - 1;
  253.       yyvsp = yyvs + size - 1;
  254.  
  255.       if (yydebug)
  256.     fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
  257.  
  258.       if (yyssp >= yyss + yymaxdepth - 1)
  259.     YYERROR;
  260.     }
  261.  
  262.   if (yydebug)
  263.     fprintf(stderr, "Entering state %d\n", yystate);
  264.  
  265. /* Do appropriate processing given the current state.  */
  266. /* Read a lookahead token if we need one and don't already have one.  */
  267. yyresume:
  268.  
  269.   /* First try to decide what to do without reference to lookahead token.  */
  270.  
  271.   yyn = yypact[yystate];
  272.   if (yyn == YYFLAG)
  273.     goto yydefault;
  274.  
  275.   /* Not known => get a lookahead token if don't already have one.  */
  276.  
  277.   /* yychar is either YYEMPTY or YYEOF
  278.      or a valid token in external form.  */
  279.  
  280.   if (yychar == YYEMPTY)
  281.     {
  282.       yychar = YYLEX;
  283.     }
  284.  
  285.   /* Convert token to internal form (in yychar1) for indexing tables with */
  286.  
  287.   if (yychar <= 0)        /* This means end of input. */
  288.     {
  289.       yychar1 = 0;
  290.       yychar = YYEOF;        /* Don't call YYLEX any more */
  291.  
  292.       if (yydebug)
  293.     fprintf(stderr, "Now at end of input.\n");
  294.     }
  295.   else
  296.     {
  297.       yychar1 = YYTRANSLATE(yychar);
  298.  
  299.       if (yydebug)
  300.     fprintf(stderr, "Parsing next token; it is %d (%s)\n", yychar, yytname[yychar1]);
  301.     }
  302.  
  303.   yyn += yychar1;
  304.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  305.     goto yydefault;
  306.  
  307.   yyn = yytable[yyn];
  308.  
  309.   /* yyn is what to do for this token type in this state.
  310.      Negative => reduce, -yyn is rule number.
  311.      Positive => shift, yyn is new state.
  312.        New state is final state => don't bother to shift,
  313.        just return success.
  314.      0, or most negative number => error.  */
  315.  
  316.   if (yyn < 0)
  317.     {
  318.       if (yyn == YYFLAG)
  319.     goto yyerrlab;
  320.       yyn = -yyn;
  321.       goto yyreduce;
  322.     }
  323.   else if (yyn == 0)
  324.     goto yyerrlab;
  325.  
  326.   if (yyn == YYFINAL)
  327.     YYACCEPT;
  328.  
  329.   /* Shift the lookahead token.  */
  330.  
  331.   if (yydebug)
  332.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  333.  
  334.   /* Discard the token being shifted unless it is eof.  */
  335.   if (yychar != YYEOF)
  336.     yychar = YYEMPTY;
  337.  
  338.   *++yyvsp = yylval;
  339.   *++yylsp = yylloc;
  340.  
  341.   /* count tokens shifted since error; after three, turn off error status.  */
  342.   if (yyerrstatus) yyerrstatus--;
  343.  
  344.   yystate = yyn;
  345.   goto yynewstate;
  346.  
  347. /* Do the default action for the current state.  */
  348. yydefault:
  349.  
  350.   yyn = yydefact[yystate];
  351.   if (yyn == 0)
  352.     goto yyerrlab;
  353.  
  354. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  355. yyreduce:
  356.   yylen = yyr2[yyn];
  357.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  358.  
  359.   if (yydebug)
  360.     {
  361.       if (yylen == 1)
  362.     fprintf (stderr, "Reducing 1 value via line %d, ",
  363.          yyrline[yyn]);
  364.       else
  365.     fprintf (stderr, "Reducing %d values via line %d, ",
  366.          yylen, yyrline[yyn]);
  367.     }
  368.  
  369. $   /* the action file gets copied in in place of this dollarsign */
  370. #line 303 "bison.simple"
  371.  
  372.   yyvsp -= yylen;
  373.   yylsp -= yylen;
  374.   yyssp -= yylen;
  375.  
  376.   if (yydebug)
  377.     {
  378.       short *ssp1 = yyss - 1;
  379.       fprintf (stderr, "state stack now", yyssp-yyss);
  380.       while (ssp1 != yyssp)
  381.     fprintf (stderr, " %d", *++ssp1);
  382.       fprintf (stderr, "\n");
  383.     }
  384.  
  385.   *++yyvsp = yyval;
  386.  
  387.   yylsp++;
  388.   if (yylen == 0)
  389.     {
  390.       yylsp->first_line = yylloc.first_line;
  391.       yylsp->first_column = yylloc.first_column;
  392.       yylsp->last_line = (yylsp-1)->last_line;
  393.       yylsp->last_column = (yylsp-1)->last_column;
  394.       yylsp->text = 0;
  395.     }
  396.   else
  397.     {
  398.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  399.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  400.     }
  401.  
  402.   /* Now "shift" the result of the reduction.
  403.      Determine what state that goes to,
  404.      based on the state we popped back to
  405.      and the rule number reduced by.  */
  406.  
  407.   yyn = yyr1[yyn];
  408.  
  409.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  410.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  411.     yystate = yytable[yystate];
  412.   else
  413.     yystate = yydefgoto[yyn - YYNTBASE];
  414.  
  415.   goto yynewstate;
  416.  
  417. yyerrlab:   /* here on detecting error */
  418.  
  419.   if (! yyerrstatus)
  420.     /* If not already recovering from an error, report this error.  */
  421.     {
  422.       yyerror("parse error");
  423.     }
  424.  
  425.   if (yyerrstatus == 3)
  426.     {
  427.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  428.  
  429.       /* return failure if at end of input */
  430.       if (yychar == YYEOF)
  431.     YYERROR;
  432.  
  433.       if (yydebug)
  434.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  435.  
  436.       yychar = YYEMPTY;
  437.     }
  438.  
  439.   /* Else will try to reuse lookahead token
  440.      after shifting the error token.  */
  441.  
  442.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  443.  
  444.   goto yyerrhandle;
  445.  
  446. yyerrdefault:  /* current state does not do anything special for the error token. */
  447.  
  448. #if 0
  449.   /* This is wrong; only states that explicitly want error tokens
  450.      should shift them.  */
  451.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  452.   if (yyn) goto yydefault;
  453. #endif
  454.  
  455. yyerrpop:   /* pop the current state because it cannot handle the error token */
  456.  
  457.   if (yyssp == yyss) YYERROR;
  458.   yyvsp--;
  459.   yylsp--;
  460.   yystate = *--yyssp;
  461.  
  462.   if (yydebug)
  463.     {
  464.       short *ssp1 = yyss - 1;
  465.       fprintf (stderr, "Error: state stack now", yyssp-yyss);
  466.       while (ssp1 != yyssp)
  467.     fprintf (stderr, " %d", *++ssp1);
  468.       fprintf (stderr, "\n");
  469.     }
  470.  
  471. yyerrhandle:
  472.  
  473.   yyn = yypact[yystate];
  474.   if (yyn == YYFLAG)
  475.     goto yyerrdefault;
  476.  
  477.   yyn += YYTERROR;
  478.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  479.     goto yyerrdefault;
  480.  
  481.   yyn = yytable[yyn];
  482.   if (yyn < 0)
  483.     {
  484.       if (yyn == YYFLAG)
  485.     goto yyerrpop;
  486.       yyn = -yyn;
  487.       goto yyreduce;
  488.     }
  489.   else if (yyn == 0)
  490.     goto yyerrpop;
  491.  
  492.   if (yyn == YYFINAL)
  493.     YYACCEPT;
  494.  
  495.   if (yydebug)
  496.     fprintf(stderr, "Shifting error token, ");
  497.  
  498.   *++yyvsp = yylval;
  499.   *++yylsp = yylloc;
  500.  
  501.   yystate = yyn;
  502.   goto yynewstate;
  503. }
  504.